import numpy as np

x = np.random.rand(8)
print(x)

xf = np.fft.fft(x)
print(xf)
print(type(xf))
print(len(xf))

ixf = np.fft.ifft(xf)
print(ixf)

x = np.ones(8)
print(x)
xf = np.fft.fft(x)
print(xf / len(x))

x = np.arange(0, 2 * np.pi, 2 * np.pi / 8)
y = np.sin(x)
xf = np.fft.fft(y) / len(y)
print(xf)

vec1 = np.array([1, 2, 3, 3])
vec2 = np.array([1, 2, 3, 4])
dis1 = np.sqrt(np.sum(np.square(vec1 - vec2)))
print(dis1)
xv1 = np.fft.fft(vec1)
xv2 = np.fft.fft(vec2)
dis2 = np.sqrt(np.sum(np.square(xv1 - xv2)))
print(abs(dis2))
print(abs(dis1 - dis2))
